# coding: UTF-8
'''
Created on 2011-5-6

@author: yang_wanjun
'''
from django.db import models

class CommentManager(models.Manager):
    def get_comments(self, blog):
        return super(CommentManager, self).get_query_set().filter().order_by('submit_date')
    
    def get_children_by_id(self, id):
        list = []
        comments = self.get_query_set().filter(is_public=True).order_by('submit_date')
        for comment in comments:
            if comment.parent_id == id:
                list.append(comment)

        return list
    
